/**
 * 名称： 企业文档相关接口
 * 作者： 王景赢
 * 日期： 2024-12-10
 * 对接人： 郭伟
 * 
*/

import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge, system, resource } from '@/api/apiModulesType';

// 查询企业文档树树-左边树结构
export const apiTreeFileSelectTree = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/queryTree`,
        method: 'get',
        params: query
    });
};

// 创建文件夹
export const apiTreeFileSelectTreeAddFolder = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/addFolder`,
        method: 'post',
        data: data
    });
};

// 企业文档右侧文件列表
export const apieEnterpriseFilesTreeQueryPaging = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/queryPaging`,
        method: 'get',
        params: query
    });
};

// 企业文档作废
export const apiRecycleBinRemoveFile = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/recycleBin/removeFile`,
        method: 'get',
        params: query
    });
};

// 收藏
export const apiFilesCollectionAddCollection = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/filesCollection/addCollection`,
        method: 'post',
        data: data
    });
};

// 取消收藏
export const apifilesCollectionCancelCollection = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/filesCollection/cancelCollection`,
        method: 'post',
        data: data
    });
};

// 订阅
export const apiFileAttentionAddAttention = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/fileAttention/addAttention`,
        method: 'post',
        data: data
    });
};

// 取消订阅
export const apiFileAttentionCancelAttention = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/fileAttention/cancelAttention`,
        method: 'post',
        data: data
    });
};

// 置顶
export const apiEnterpriseFilesTreeTop = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/top`,
        method: 'post',
        data: data
    });
};

// 文件重命名
export const apiEnterpriseFilesTreeRename = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/rename`,
        method: 'post',
        data: data
    });
};

// 获取历史版本
export const apiOnlineSelectFilesVersions = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/online/selectFilesVersions`,
        method: 'post',
        data: data
    });
};

// 获取下载记录
export const apiDownloadRecordQuery = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${resource}/oss/file/date/downloadRecord  `,
        method: 'post',
        data: data
    });
};


// 获取企业文件上传checkBox状态
export const apiGetEnterpriseFilesTreeIsKnowLab = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/isKnowLab`,
        method: 'get',
        params: query
    });
}

// 查看记录
export const apiFilesRecentlyViewed = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${resource}/oss/filesRecentlyViewed`,
        method: 'get',
        params: query
    });
}

// 修改描述
export const apiEnterpriseFilesTreeUpdateRemarks = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/updateRemarks`,
        method: 'post',
        data: data
    });
}

// 查询标签文档
export const apiFilesLabelRecordQuerySelect= (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/api/filesLabelRecord/querySelect`,
        method: 'get',
        params: query
    });
}

// 标签文档添加
export const apiFilesLabelRecordCreate = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/api/filesLabelRecord/create`,
        method: 'post',
        data: data
    });
}

// 重新加入问答知识库
export const apiEnterpriseFilesTreeUpdateAiFiles = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/updateAiFiles`,
        method: 'post',
        data: data
    });
}

// 上传问答知识库
export const apiEnterpriseFilesTreeToDify = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/toDify`,
        method: 'post',
        data: data
    });
}

// 查询是否开启es搜索
export const apiEsConfigGet = (): AxiosPromise<any[]> => {
    return request({
        url: `/${resource}/es/config/get`,
        method: 'get',
    });
}

// es查询
export const apiOssSearchInfo = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${resource}/es/oss/searchInfo`,
        method: 'get',
        params: query
    });
}